import { handleActions } from 'redux-actions'
import { get_products, get_products_success } from '../actions/product'
const initiaState = {
    sold:[],
    createdAt:[]
}
const productReducer = handleActions({
    [get_products_success]: (state,action) => ({
        ...state,
        [action.payload.sortBy]: action.payload.products
    }),
},initiaState)
export default productReducer